package com.gec.system.service.impl;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.gec.model.entity.SysHouse;
import com.gec.model.vo.SysHouseQueryVo;
import com.gec.system.mapper.SysHouseMapper;

import com.gec.system.service.SysHouseService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
/**
 * <p>
 * 房屋表 服务实现类
 *
 * </p>
 *
 * @author Liangxj
 * @since 2023-12-06
 */
@Service
public class SysHouseServiceImpl extends ServiceImpl<SysHouseMapper, SysHouse> implements SysHouseService {

    @Autowired
    private SysHouseMapper sysHouseMapper;


    @Override
    public IPage<SysHouse> selectPage(IPage<SysHouse> iPage, SysHouseQueryVo sysHouseQueryVo) {
        return this.sysHouseMapper.selectPage(iPage, sysHouseQueryVo);
    }

    @Override
    public String getCode() {
        String code= this.sysHouseMapper.getCode();
        if(code!=null){
            //截取字段xq20231XXXX,将获取的到的结果+1后返回给控制层
            String sub = code.substring(2);
            //将字符串转换成Intger
            int number = Integer.parseInt(sub)+1;
            return "fw"+number;
        }
        return "";
    }
}
